package com.lin.videospringboot.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lin.videospringboot.been.Post;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface PostMapper extends BaseMapper<Post> {

//    联表
    @Select("SELECT a.postId,a.content,a.likes,a.dislikes,b.userId,b.name,b.url FROM post a , `user` b WHERE a.`userId` = b.`userId` ORDER BY a.time DESC")
    List<Map<String,Object>> getPostWithUserInfo(Page<Map<String,Object>> page);

}
